<script setup lang="ts">
import { defineProps, ref } from 'vue'

const props = defineProps({
  formData: {
    type: Object,
    required: true
  },
  isOrder: {
    type: Boolean,
    default: false
  }
})

// 在子组件中添加
const formRef = ref()

// 暴露验证方法给父组件
defineExpose({
  validate: () => formRef.value?.validate()
})
</script>

<template>
  <nut-form class="w-full" :model-value="formData" ref="formRef">
    <!-- 备注 -->
    <nut-form-item label="备注" prop="remark">
      <nut-textarea :readonly="isOrder" placeholder="请输入备注" max-length="255" v-model="formData.remark" />
    </nut-form-item>
  </nut-form>
</template>